home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C & C++ Multimedia Cyber Classroom
/
C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso
/
src
/
fig16_25.jar
/
Ch16
/
Fig16_25
/
Fig16_25.cpp
Wrap
C/C++ Source or Header
|
1997-11-10
|
495b
|
21 lines
// Fig. 16.25: fig16_25.cpp
// Using strtol
#include <iostream.h>
#include <stdlib.h>
int main()
{
long x;
char *string = "-1234567abc", *remainderPtr;
x = strtol( string, &remainderPtr, 0 );
cout << "The original string is \"" << string
<< "\"\nThe converted value is " << x
<< "\nThe remainder of the original string is \""
<< remainderPtr
<< "\"\nThe converted value plus 567 is "
<< x + 567 << endl;
return 0;
}